import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { StyleSheet, Text, TouchableOpacity } from 'react-native'

// create a component
class TextButton extends PureComponent {
  static propTypes = {
    onPress: PropTypes.func,
    disabled: PropTypes.bool,
    style: PropTypes.any,
    containerStyle: PropTypes.any,
    title: PropTypes.string,
    activeOpacity: PropTypes.number,
  }

  static defaultProps = {
    onPress: () => {},
    disabled: false,
    activeOpacity: 0.8,
    style: {},
    containerStyle: {},
    title: '',
  }

  render() {
    const {
      onPress,
      disabled,
      style,
      containerStyle,
      title,
      activeOpacity,
    } = this.props
    return (
      <TouchableOpacity
        style={[styles.container, containerStyle]}
        onPress={onPress}
        disabled={disabled}
        activeOpacity={activeOpacity}
      >
        <Text style={style}>{title}</Text>
      </TouchableOpacity>
    )
  }
}
// define your styles
const styles = StyleSheet.create({
  container: {
  },
})

export default TextButton
